package com.pureut.system.api;

import com.pureut.common.core.constant.ServiceNameConstants;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.system.api.domain.CustomerManagement;
import com.pureut.system.api.factory.RemoteOrderFallbackFactory;
import com.pureut.system.api.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


/** 订单模块feign
 * @author yiBao
 */
@FeignClient(contextId = "orderFeignService", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = RemoteOrderFallbackFactory.class)
public interface OrderFeignService {

    /**
     * 查看供应商信息
     */
    @GetMapping("/supplier-management/view/{id}")
    public AjaxResult view(@PathVariable("id") Long id);

    /**
     * 查看加工商信息
     */
    @GetMapping("/converter-management/view/{id}")
    public AjaxResult getConverterView(@PathVariable("id") Long id);

    /**
     * 查看客户信息
     */
    @GetMapping("/customer-management/view/{id}")
    public AjaxResult customerView(@PathVariable("id") Long id);


    /**
     * 获取销售订单明细
     */
    @GetMapping("/sales-order-detail/getDetailById")
    public AjaxResult getDetailById(@RequestParam("salesOrderId") Long salesOrderId, @RequestParam("materialCode") String materialCode);


    /**
     * 修改采购订单数据（feign调用）
     */
    @PostMapping("/purchase-order/updateOrderData")
    public AjaxResult updateOrderData(@RequestBody UpdatePurchaseOrderDataVo updatePurchaseOrderDataVo);

    /**
     * 排程模块回传数据，修改销售订单状态及数据（feign调用）
     */
    @PutMapping("/sales-order/updateDataByScheduling")
    public AjaxResult updateDataByScheduling(@RequestBody UpdateDataBySchedulingVo updateDataBySchedulingVo);

    /**
     * 根据销售订单修改对应明细状态（生产计划 feign调用）
     */
    @PostMapping("/sales-order/updateSaleOrderDetailStatus")
    public void updateSaleOrderDetailStatus(@RequestBody UpdateSaleOrderDetailStatusVo updateSaleOrderDetailStatusVo);

    /**
     * 成品称重页面回传数据至销售订单(成品称重 feign调用)
     */
    @PostMapping("/sales-order/backData")
    public void backData(@RequestBody BackDataVo backDataVo);

    /**
     * 销售发货回传发货重量到销售订单
     * @param backDataVo
     */
    @PostMapping("/sales-order/updateShippingWeight")
    public boolean updateShippingWeight(@RequestBody BackDataVo backDataVo);

    /**
     * 销售发货回传发货重量扣除销售订单
     * @param backDataVo
     */
    @PostMapping("/sales-order/updateShippingWeightSub")
    public boolean updateShippingWeightSub(@RequestBody BackDataVo backDataVo);

    /**
     * 修改采购订单退货重量（累加）Feign
     */
    @PostMapping("/purchase-order/updateSalesReturn")
    public boolean updateSalesReturn(@RequestBody UpdatePurchaseOrderDataVo updatePurchaseOrderDataVo);

    /**
     * 修改采购订单退货重量（扣除）
     * @param updatePurchaseOrderDataVo
     * @return
     */
    @PostMapping("/purchase-order/updateDeductSalesReturn")
    public boolean updateDeductSalesReturn(@RequestBody UpdatePurchaseOrderDataVo updatePurchaseOrderDataVo);

    /**
     * Fegin销售退货重量回传
     * @param backDataVo
     * @return
     */
    @PostMapping("/sales-order/updateShippingWeightBack")
    public boolean updateShippingOutWeight(@RequestBody BackDataVo backDataVo);

    /**
     * feign销售发货退货重量回传（扣减）
     * @param backDataVo
     * @return
     */
    @PostMapping("/sales-order/updateShippingWeightSubBack")
    public boolean updateShippingWeightSubBack(@RequestBody BackDataVo backDataVo);

    /**
     * 委外入库回传委外订单（fegin调用）
     */
    @PostMapping("/subcontracting-order/updateSubcontractingOrderData")
    public boolean updateSubcontractingOrderData(@RequestBody UpdateSubcontractingOrderDataVo updateSubcontractingOrderDataVo);

    /**
     * 委外入库回传委外订单（撤销 fegin调用）
     */
    @PostMapping("/subcontracting-order/updateSubcontractingOrderDataDelete")
    public boolean updateSubcontractingOrderDataDelete(@RequestBody UpdateSubcontractingOrderDataVo updateSubcontractingOrderDataVo);

    /**
     * 委外退货回传委外订单（fegin退货重量）
     */
    @PostMapping("/subcontracting-order/updateBackOrderData")
    public boolean updateBackOrderData(@RequestBody UpdateSubcontractingOrderDataVo updateSubcontractingOrderDataVo) ;


    /**
     * 委外退货回传委外订单（fegin退货重量-减）
     */
    @PostMapping("/subcontracting-order/updateBackOrderDataDelete")
    public boolean updateBackOrderDataDelete(@RequestBody UpdateSubcontractingOrderDataVo updateSubcontractingOrderDataVo);

    /**
     * 委外入库回传销售订单明细委外重量(委外入库fegin调用)
     */
    @PostMapping("/sales-order/updateSubWeight")
    public boolean updateSubWeight(@RequestBody BackDataVo backDataVo);

    /**
     * 通过客户名称获取客户id
     * @param customerName
     * @return
     */
    @GetMapping("/customer-management/getCustomerId")
    public CustomerManagement getCustomerId(@RequestParam("customerName") String customerName);

    /**
     * 排程修改销售订单明细状态为已完成
     */
    @PostMapping("/sales-order/updateSaleStatus")
    public boolean updateSaleStatus(@RequestBody BackDataVo backDataVo);

    /**
     * 判断销售订单的明细状态，同步修改销售订单的状态
     */
    @PutMapping("/sales-order/updateSaleDocument")
    public boolean updateSaleDocument(@RequestBody SaleDocumentVo saleDocumentVo);

    /**
     * 委外入库扣减销售订单明细委外重量(委外入库fegin调用)
     */
    @PostMapping("/sales-order/updateSubWeightDelete")
    public boolean updateSubWeightDelete(@RequestBody BackDataVo backDataVo);


}
